﻿<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="java.util.*" %>
<%@ page import="java.net.*" %>

<%
	String keyname = URLDecoder.decode(request.getParameter("k"),"UTF-8");
 %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>「<%= keyname %>」的搜索结果 - 3DS DS 游戏 资讯 攻略 发售 下载</title>
<meta name="description" content="" />
<meta name="keywords" content="动作冒险 DSDOWN 3DS DS DSI GB GBA WII WIIU Nintendo 任天堂 游戏 攻略 发售 资讯 " />
<link href="style/list.css" rel="stylesheet" type="text/css" />
<link href="style/search.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style></head>

<script src="script/functions.js" type="text/javascript"></script>
<script src="script/jQuery.js" type="text/javascript"></script>

<script>
	var nullsearch = '<%= keyname %>';
	
	$(document).ready(
		function()
		{
			$("#searchtext").keydown(
			function(e)
			{
				if(e.which==13) doSearch();
			}
			)
		}
	)
	
	function doSearch()
	{
		var value = $("#searchtext").val();
		if (value=='' || value == nullsearch)
		{
			alert('请输入关键字');
			$("#searchtext").focus();
		}
		else if (value.length < 3)
		{
			alert('关键字太短，无法搜索');
			$("#searchtext").focus();
			$("#searchtext").select();
		}
		else
		{
			var uri = 'search.do?k='+ encodeURI(encodeURI(value));
			window.open(uri);
		}
	}
</script>

<body>

<!-- 外层 -->
<div class="detail">

<!-- 主页面 -->
<div class="main">

	<%@ include file="header.jsp" %>

	<div class="header_shadow"></div>
	
	<!-- 外框阴影 -->
	<div class="center_shadow">
	<!-- 内容 -->
	<div class="content">
      	<!-- 关键字 -->
      	<div class="searchkeyname" style="float: left">
      	「<%= keyname %>」的搜索结果
      	</div>
      	
      	<div style="float:right; margin-top:-10px">
      		<ul class="searchborder">
				<li class="inlineli">
					<input id="searchtext" type="text" class="searchinput" value="<%= keyname %>" onfocus="if(this.value==nullsearch){this.value='';this.style.color='#000000';}" onblur="if(this.value==''){this.value=nullsearch;this.style.color='#888888';}" />
				</li>
				<li class="inlineli">
			        <a href="javascript:doSearch();" title="搜索" ></a>
				</li>
			</ul>  	
      	</div>
      	
      	<!-- 游戏列表 -->
      	<div class="searchtitle" style="clear: both">
      	相关游戏
      	</div>
      	
      	<div class="gamediv">
      	
		<% List<java.util.Map> gameList = (List<java.util.Map>)request.getAttribute("gameList"); %>
		<% for (int i=0;i<gameList.size();i++){ %>
		
		<% if (i%4==0){ %><ul class="gameul"><%} %>
		
		<li class="inlineli" style="float:left;">
		<a class="searchitem" href="gamedetail.do?id=<%= gameList.get(i).get("game_id") %>" target="_blank">
			<div>
				<img src="<%= gameList.get(i).get("game_img_small") %>" />
				<big><%= gameList.get(i).get("simplified_chinese_name") %></big>
				<small>发行商：<%= gameList.get(i).get("game_publish_company") %></small>
				<small>类型：<%= gameList.get(i).get("game_type_name") %></small>
			</div>
		</a>
		</li>
		
		<% if (i%4==3 || i>=gameList.size()-1){ %></ul><%} %>
		<% } %>
		
		</div>
		
		<%if (gameList.size()==0){ %>
		<div class="noresult">没有匹配的游戏</div>
		<%} %>
		
		<!-- 文章列表 -->
      	<div class="searchtitle">
      	相关文章
      	</div>
		
		<div>
		
		<% List<java.util.Map> articleList = (List<java.util.Map>)request.getAttribute("articleList"); %>
		<% for (int i=0;i<articleList.size();i++){ %>
		
		<% if (i%4==0){ %><ul class="articleul"><%} %>
		
		<li class="inlineli" style="float:left;">
		<a class="searchitem" href="articledetail.do?id=<%= articleList.get(i).get("article_id") %>" target="_blank">
			<div>
				<img src="<%= articleList.get(i).get("article_icon") %>" />
				<big><%= articleList.get(i).get("article_name") %></big>
				<small>类型：<%= articleList.get(i).get("article_type_name") %></small>
			</div>
		</a>
		</li>
		
		<% if (i%4==3 || i>=gameList.size()-1){ %></ul><%} %>
		<% } %>
		
		</div>
		
		<%if (articleList.size()==0){ %>
		<div class="noresult">没有匹配的文章</div>
		<%} %>
		
			
		<script type="text/javascript">
			limitCharacterLength(".searchitem>div>big",24);
			limitCharacterLength(".searchitem>div>small",30);
			limitCharacterLength(".searchkeyname",40);			
		</script>
		<!-- page -->
	</div>
	<!-- 内容 -->
	</div>
	<!-- 外框阴影 -->
	
	<div class="footer_shadow"></div>	
	
	<%@ include file="footer.jsp" %>
	
</div>
<!-- 主页面 -->
</div>
<!-- 外层 -->

</body>
</html>